/**
 * 
 */
package org.jenkon.commons.collection.iterator;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

/**
 * @author Jens Konopka
 * 
 */
public class ZipFileIterator implements Iterator<ZipEntry> {

	private final Enumeration<? extends ZipEntry> entries;

	/**
	 * @param zipFile {@link ZipFile}
	 */
	public ZipFileIterator(final ZipFile zipFile) {
		this.entries = zipFile.entries();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#hasNext()
	 */
	public boolean hasNext() {
		return entries.hasMoreElements();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#next()
	 */
	public ZipEntry next() {
		return entries.nextElement();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#remove()
	 */
	public void remove() {
		throw new UnsupportedOperationException("remove is not supported on " + getClass());
	}

}
